<?php

/**
 * Created by PhpStorm.
 * User: 10749
 * Date: 2017/6/5
 * Time: 19:28
 */
class Model_User extends PhalApi_Model_NotORM{
    /*
     * π框架数据库关联查询
$sql = 'select * from example AS ep LEFT JOIN user AS u ON ep.ui
d = u.id  where ep.touid = :userId ORDER BY dateline desc LIMIT :start,:num';
$params = array(':userId' => $userId, ':start' => $start, ':num' => $num);
$rs= DI()->notorm->example->queryAll($sql, $params);
     * */
    protected function getTableName($userid)
    {
        return 'user';
    }
    protected function getTableKey()
    {
        return 'userid';
    }

    public function userReg($data){

//        $sql = 'select * from t_user';
//        $rs= DI()->notorm->example->queryAll($sql);
//        return $rs;
        return $this->getORM()->insert(array(
            "username" => $data->username,
            "password"=> $data->password,
            "nikename" => $data->nikename,
            "phone" => $data->phone,
            "time" => time()
        ));
    }
}
